﻿using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Collections.Generic;

namespace ProjectMadaktariMVC.Models
{
    public class ConfigurationDAO
    {
        /// <summary>
        /// Returns all hospitals in the system
        /// </summary>
        /// <param name="db">The datacontext to use.</param>
        /// <returns></returns>
        public static List<Hospital> GetHospitals(MadaktariDataContext db)
        {
            return db.Hospitals.ToList();
        }

        /// <summary>
        /// Returns all referral locations in the system
        /// </summary>
        /// <param name="db">The datacontext to use.</param>
        /// <returns></returns>
        public static List<ReferralLocation> GetreferralLocations(MadaktariDataContext db)
        {
            return db.ReferralLocations.ToList();
        }

        /// <summary>
        /// Returns all Diagnosies
        /// </summary>
        /// <param name="db">The datacontext to use.</param>
        /// <returns></returns>
        public static List<Diagnosi> GetDiagnoses(MadaktariDataContext db)
        {
            return db.Diagnosis.ToList();
        }

        /// <summary>
        /// Returns a Diagnosis with the specified id
        /// </summary>
        /// <param name="db">The datacontext to use.</param>
        /// <param name="id"></param>
        /// <returns></returns>
        public static Diagnosi GetDiagnosisById(MadaktariDataContext db, int id)
        {
            return db.Diagnosis.Single(d => d.Id == id);
        }

        /// <summary>
        /// Returns all of the concomitant diagnoses in the system.
        /// </summary>
        /// <param name="db">The datacontext to use.</param>
        /// <returns></returns>
        public static List<ConcomitantDiagnosi> GetConcomitantDiagnoses(MadaktariDataContext db)
        {
            return db.ConcomitantDiagnosis.ToList();
        }

        /// <summary>
        /// Returns concomitant diagnosis with given id.
        /// </summary>
        /// <param name="db">The datacontext to use.</param>
        /// <param name="id"></param>
        /// <returns></returns>
        public static ConcomitantDiagnosi GetConcomitantDiagnosis(MadaktariDataContext db, int id)
        {
            return db.ConcomitantDiagnosis.Single(c => c.Id == id);
        }

        /// <summary>
        /// Returns all Procedure Types in the system
        /// </summary>
        /// <param name="db">The datacontext to use.</param>
        /// <returns></returns>
        public static List<ProcedureType> GetProcedureTypes(MadaktariDataContext db)
        {
            return db.ProcedureTypes.ToList();
        }

        /// <summary>
        /// Returns all surgeons in the system
        /// </summary>
        /// <param name="db">The datacontext to use.</param>
        /// <returns></returns>
        public static List<Surgeon> GetSurgeons(MadaktariDataContext db)
        {
            return db.Surgeons.ToList();
        }

        /// <summary>
        /// Returns all tribes in the system
        /// </summary>
        /// <param name="db">The datacontext to use.</param>
        /// <returns></returns>
        public static List<Tribe> GetTribes(MadaktariDataContext db)
        {
            return db.Tribes.ToList();
        }

    }
}
